// express
let express = require('express')
let webpack = require('webpack')

// 中间件
let middle = require('webpack-dev-middleware')
// 引入webpack 的配置文件
let config = require('./webpack.config')
// 生成webpack 编译之后的 数据
let compiler = webpack(config)



let app = express()

// 使用中间键 用服务端的端口启动 webpack
app.use(middle(compiler))

app.get('/user', (req, res) => {
  res.json({
    name: 'gzt'
  })
})

app.listen(3000)